#include <stdio.h>
#include <time.h>

void getISOTime(char* buffer, size_t bufferSize);

int main(void) {
  char buf[80];

  getISOTime(buf, sizeof(buf));
  printf("<%s>\n", buf);

  return 0;
}

void getISOTime(char *buffer, size_t bufferSize) {
	struct tm *t;
	time_t current_time;

	time(&current_time);
	t = localtime(&current_time);

	printf("%ld\n", current_time);
	printf(ctime(&current_time));

  printf("--->\n");
  sprintf(buffer, bufferSize, "%04d-%02d-%02d %02d:%02d:%02d",
              t.tm_year + 1900, t.tm_mon + 1, t.tm_mday,
              t.tm_hour, t.tm_min, t.tm_sec
          );
  printf("--->\n");
}
